package cn.xtits.xtf.common.db.shard;

import cn.xtits.xtf.common.utils.JodaDateUtil;
import org.springframework.util.Assert;

/**
 * Created by ShengHaiJiang on 16/4/5.
 */
public class DefaultXTTableShardStrategy implements XTTableShardStrategy {
    @Override
    public String shardTableByMonth(String tableName, String date) {
        Assert.notNull(tableName);
        Assert.notNull(date);
        String month = JodaDateUtil.getDateOfSpecified(date, "yyyyMM");
        return tableName + "_" + month;
    }
}
